package org.dizena.common.utils;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import org.dizena.common.base.enums.EnumResultCode;

public class RpcUtil {

    public static String wrapperResult(String resultStr) {
        try {
            JSONObject json = JSON.parseObject(resultStr);
            int code = json.getIntValue("code");
            String data = null;
            if (code == EnumResultCode.SUCCESS.code()) {
                data = json.getString("data");
            }
            if (data != null) {
                resultStr = data;
            }
        } catch (Exception e) {
        }
        return resultStr;
    }
}
